package springstudy;

import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 自动装配引导类 {@link springstudy.configuration.HelloWorldAutoConfiguration} 和 {@link EnableAutoConfiguration}标签
 * @Author acy
 * @Date 2019/04/25
 */
@EnableAutoConfiguration
@EnableScheduling
public class EnableAutoConfigurationBootstrap {
	public static void main(String[] args) {
		ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(EnableAutoConfigurationBootstrap.class)
				.web(WebApplicationType.NONE)
				.run(args);
		String helloWorld = applicationContext.getBean("helloWorld", String.class);
		System.out.println("helloWorld Bean "+helloWorld);
		//关闭上下文
		applicationContext.close();
	}
}
